package com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.imp;


import com.yunweiweishi.xuhuanpaltform.yuhuan_app.dao.RouteDao;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.pojo.PatrolRoute;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.RouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Service
@Transactional
public class RouteServiceImpl implements RouteService {

     @Autowired
    private RouteDao routeDao;

    @Override
    public PatrolRoute findRouteByRouteName(String patrolName) {


      return routeDao.findRouteByPatrolName(patrolName);


    }

    /**
     * 添加路线
     * @param patrolRoute
     */
    @Override
    public void addRoute(PatrolRoute patrolRoute) {

        routeDao.save(patrolRoute);
    }

    /**
     * 更新路线
     * @param patrolRoute
     */
    @Override
    public void UpdateRouteById(PatrolRoute patrolRoute) {
        routeDao.save(patrolRoute);

    }


    /**
     * 根据ID进行删除
     * @param id
     */
    @Override
    public void deleteRouteById(Long id) {

        routeDao.deleteById(id);
    }


}
